import request from '@/utils/request'

// 创建损失原因
export function createLossReason(data) {
  return request({
    url: '/lamp/loss-reason/create',
    method: 'post',
    data: data
  })
}

// 更新损失原因
export function updateLossReason(data) {
  return request({
    url: '/lamp/loss-reason/update',
    method: 'put',
    data: data
  })
}

// 删除损失原因
export function deleteLossReason(id) {
  return request({
    url: '/lamp/loss-reason/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除损失原因 */
export function deleteLossReasonList(ids) {
  return request({
    url: `/lamp/loss-reason/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得损失原因
export function getLossReason(id) {
  return request({
    url: '/lamp/loss-reason/get?id=' + id,
    method: 'get'
  })
}

// 获得损失原因分页
export function getLossReasonPage(params) {
  return request({
    url: '/lamp/loss-reason/page',
    method: 'get',
    params
  })
}
// 导出损失原因 Excel
export function exportLossReasonExcel(params) {
  return request({
    url: '/lamp/loss-reason/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}